﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhuongDoAn
{
    public partial class Default : System.Web.UI.Page
    {
        public string loginUrl = "uc/uc_login.ascx";
        public string registerurl = "UC/register.ascx";
        public string ratingurl = "UC/uc_rating.ascx";
        public string homepage_content = "uc/uc_home.ascx";
        public string homepage_left = "uc/uc_left.ascx";
        public string homepage_right = "uc/uc_right.ascx";
        public string homepage_header = "uc/uc_header.ascx";
        public string advanceSearchUrl = "uc/uc_advanceSearch.ascx";
        public string listUrl = "uc/uc_list.ascx";
        public string listnewUrl = "uc/uc_listnew.ascx";
        public string detailUrl = "uc/uc_detail.ascx";
        public string hintForIuUrl = "uc/uc_hint.ascx";
        public string contactUrl = "uc/uc_contact.ascx";

        protected void Page_Load(object sender, EventArgs e)
        {
            plcHeader.Controls.Add(LoadControl(homepage_header));
            plcLeft.Controls.Add(LoadControl(homepage_left));
            plcRight.Controls.Add(LoadControl(homepage_right));
            //
            string page = Request.QueryString["page"] != null ? Request.QueryString["page"].ToString() : "home";
            switch (page)
            {
                case "register":
                    plcMain.Controls.Add(LoadControl(registerurl));
                    break;
                case "advs":
                    plcMain.Controls.Add(LoadControl(advanceSearchUrl));
                    break;
                case "rating":
                    plcMain.Controls.Add(LoadControl(ratingurl));
                    break;
                case "login":
                    plcMain.Controls.Add(LoadControl(loginUrl));
                    break;
                case "logout":
                    Session[ConfigKey.WEB_USER] = null;
                    Response.Redirect("Default.aspx");
                    break;
                case "list":
                    plcMain.Controls.Add(LoadControl(listUrl));
                    break;
                case "listnew":
                    plcMain.Controls.Add(LoadControl(listnewUrl));
                    break;
                case "detail":
                    plcMain.Controls.Add(LoadControl(detailUrl));
                    break;
                case "hint":
                    plcMain.Controls.Add(LoadControl(hintForIuUrl));
                    break;
                case "contact":
                    plcMain.Controls.Add(LoadControl(contactUrl));
                    break;
                default:
                    plcMain.Controls.Add(LoadControl(homepage_content));
                    break;
            }
        }
    }
}